package com.jing.cloud.service.api.controller;

import com.jing.cloud.util.ErrCode;
import com.jing.cloud.util.RspUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * Created by 29017 on 2017/9/20.
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    @ExceptionHandler
    public Object handleException(Exception e) {
        log.error("api action error", e);
        return RspUtil.error(ErrCode.SERVER_ERROR, e);
    }
}
